<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <form id="my-form" class="am-form tpl-form-line-form" method="post">
                    <div class="widget-body">
                        <fieldset>
                        {if $model['status']['value'] == 0}
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">绑定微信小程序</div>
                            </div>
							<div class="widget-body am-cf">
								<div style="background:#eeeeee;margin-left:100px;border-radius:10px;padding:20px;" class="am-u-sm-6 am-u-md-6 am-u-lg-3">
									<div style="text-align:center;">我已有微信小程序</div>
									<div style="margin-top:20px;text-align:center;">
										<a class="am-btn am-btn-default am-btn-success" href="{$url}">
                                            一键授权
                                        </a>
									</div>
								</div>
								<div style="background:#eeeeee;margin-left:100px;border-radius:10px;padding:20px;" class="am-u-sm-6 am-u-md-6 am-u-lg-3">
									<div style="text-align:center;">
                                    {if !$apply}
                                        我还没有微信小程序
                                    {else /}
                                        {if $apply['pay_status']['value']==10}
                                            现在状态：<code>待付审核费</code>
                                        {else /}
                                            现在状态：<code>{$apply['apply_status']['text']}</code>
                                        {/if}
                                    {/if}
									</div>
									<div style="margin-top:20px;text-align:center;">
										<a class="am-btn am-btn-default am-btn-success" href="{$apply ? '/user/apply/index' : url('wxapp.register/wxapp')}">
                                            {$apply ? '查看详情':'快速注册'}
                                        </a>
									</div>
								</div>
								<div style="" class="am-u-sm-6 am-u-md-6 am-u-lg-3">
									
								</div>
								
							</div>
						{else /}
							<div class="tips am-margin-bottom-sm am-u-sm-12">
		                        <div class="pre-error">
		                            <p> 提醒：发布小程序前必须完成初始化配置。配置项目 1.小程序头像 2.小程序名称 3.功能介绍 4.服务器域名 5.服务类目 6.隐私设置<br>
		                            </p>
		                        </div>
		                    </div>
							<div class="widget-head am-cf">
                                <div class="widget-title am-fl">小程序信息</div>
                            </div>
							<div class="am-form-group">
                                <label class="am-u-sm-3 am-form-label">切换/更新授权 </label>
                                <div class="am-u-sm-9">
									<div class="am-btn-group am-btn-group-xs">
                                    {if $user['user']['user_name'] == 'test'}
                                        <a class="am-btn am-btn-default am-btn-secondary am-radius am-disabled" href="#">
                                            <span class="am-icon-retweet am-icon-sm"></span> 体验用户无权操作
                                        </a>
                                    {else /}
										<a class="am-btn am-btn-default am-btn-secondary am-radius" href="{$url}">
											<span class="am-icon-retweet am-icon-sm"></span> 切换/更新授权
										</a>
                                    {/if}
									</div>
                                </div>
                            </div>
							<div class="am-form-group">
                                <label class="am-u-sm-3 am-form-label">同步公众平台设置 </label>
                                <div class="am-u-sm-9">
									<div class="am-btn-group am-btn-group-xs">
										<a href="javascript:;" class="item-synchronization am-btn am-btn-default am-btn-secondary am-radius" data-ids="{$model['app_id']}">
											<span class="am-icon-refresh am-icon-sm"></span> 一键同步
										</a>
									</div>
                                </div>
                            </div>
							<div class="am-form-group">
                                <label class="am-u-sm-3 am-form-label">小程序头像 </label>
                                <div class="am-u-sm-9">
                                    <img style="float:left;margin-right:50px;border-radius: 50%;" src="{$model['head_img']}" width="72" height="72" alt="">
									<a style="float:left;margin-right:50px;" href="{$model['qrcode_url']}" target="_blank">
                                        <img style="border-radius: 50%;" src="/assets/img/qrcode.png" width="72" height="72" alt="">
                                        <div style="position:relative;left:0px;top:-45px;width:70px;font-size:10px;text-align:center;background:#000;color:#fff;opacity:0.6">
                                            线上二维码
                                        </div>
                                    </a>
									<a  style="float:left;margin-right:50px;" href="{:url('wxapp/testCode')}" title="体验二维码" target="_blank">
                                        <img style="border-radius: 50%;" src="/assets/img/qrcode.png" width="72" height="72" alt="">
                                        <div style="position:relative;left:0px;top:-45px;width:70px;font-size:10px;text-align:center;background:#000;color:#fff;opacity:0.6">体验二维码
                                        </div>
                                    </a>
									<div class="help-block am-margin-top-sm">
                                        <small>
                                        {if isset($infor['head_image_info'])}
                                            每月可修改{$infor['head_image_info']['modify_quota']}次，
                                            本月还可修改{$infor['head_image_info']['modify_quota']-$infor['head_image_info']['modify_used_count']}次。
                                        {/if}
                                            <a href="{:url('wxapp/sethead')}">修改</a>
                                        </small>
                                    </div>
                                </div>
								
                            </div>
							<div class="am-form-group">
                                <label class="am-u-sm-3 am-form-label">小程序名称 </label>
                                <div class="am-u-sm-9">
                                    <input type="text" class="tpl-form-input" value="{$model['app_name']}" disabled="disabled">
									<small>友情提醒：名称设置后不可修改<a href="{:url('wxapp.name/setting')}">设置</a></small>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-form-label">
                                    AppID <span class="tpl-form-line-small-title">小程序ID</span>
                                </label>
                                <div class="am-u-sm-9">
                                    <input type="text" class="tpl-form-input" value="{$model['app_id']}" disabled="disabled">
                                </div>
                            </div>
							<div class="am-form-group">
                                <label class="am-u-sm-3 am-form-label form-require">小程序介绍 </label>
                                <div class="am-u-sm-9">
                                    <input type="text" class="tpl-form-input" name="data[signature]" value="{$model['signature']}" required>
										<small>
                                        {if isset($infor['signature_info'])}
											每月可修改{$infor['signature_info']['modify_quota']}次，
											本月还可修改{$infor['signature_info']['modify_quota']-$infor['signature_info']['modify_used_count']}次。
										{/if}
										</small>									
                                </div>
                            </div>
							<div class="am-form-group">
                                <label class="am-u-sm-3 am-form-label form-require">服务器域名 </label>
                                <div class="am-u-sm-9">
									<input type="text" class="tpl-form-input" name="data[api_domain]" value="{$model['api_domain']}" required>
									<small>
										请确保上面域名列表至少有一个在下方域名列表中，多个以“;”隔开，否则无法正常使用小程序。<br>
										最新域名列表：{$model['serve_domain']}
									</small>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-form-label">业务域名 </label>
                                <div class="am-u-sm-9">
									<input type="text" class="tpl-form-input" name="data[webview_domain]" value="{$model['webview_domain']}">
									<small>
										非必须设置项，多个以“;”分号隔开，设置格式如：www.baidu.com。<br>
										域名前面不要加“https://”协议头，后面不要加“/”斜杠
									</small>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                    <button type="submit" class="j-submit am-btn am-btn-secondary">提交
                                    </button>
                                </div>
                            </div>
						{/if}
                        </fieldset>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
		// 同步设置
        var url = "{:url('wxapp/synchronization')}";
        $('.item-synchronization').del('app_id', url,'确定要同步吗？');

        $('#my-form').formPost();

    });
</script>
